package Primary;

public class ThreadInterrupt {
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            while(!Thread.currentThread().isInterrupted()) {
                System.out.println("I am a Thread :) ");
            }
            System.out.println("Thread was interrupted!");
        });
        t.start();
        for (int i = 0; i < 100000; i++) {

        }
        t.interrupt();
    }
}
